<!DOCTYPE HTML>
<html xmlns:wb="http://open.weibo.com/wb">
	<head>
		</script>
		<script type="text/javascript" async="" src="style/js/conversion.js"></script>
		<script src="style/js/allmobilize.min.js" charset="utf-8" id="allmobilize"></script>
		<style type="text/css"></style>
		<meta content="no-siteapp" http-equiv="Cache-Control">
		<link media="handheld" rel="alternate">
		<!-- end 云适配 -->
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
		<title>基本信息-招聘服务-东莞大学生兼职网站-最专业的企业端招聘平台</title>
		<meta content="23635710066417756375" property="qc:admins">
		<meta content="QIQ6KC1oZ6" name="baidu-site-verification">

		<!-- <div class="web_root"  style="display:none">http://www.lagou.com</div> -->
		<script type="text/javascript">
			var ctx = "http://www.lagou.com";
			console.log(1);
		</script>
		<link href="http://www.lagou.com/images/favicon.ico" rel="Shortcut Icon">
		<link href="style/css/style.css" type="text/css" rel="stylesheet">
		<link href="style/css/external.min.css" type="text/css" rel="stylesheet">
		<link href="style/css/popup.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="style/js/jquery.1.10.1.min.js"></script>
		<script src="style/js/jquery.lib.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="style/js/ajaxfileupload.js"></script>
		<script src="style/js/additional-methods.js" type="text/javascript"></script>
		<script type="text/javascript" src="style/js/template-web.js"></script>
		<script src="style/js/getUrlParam.js" type="text/javascript"></script>
		<script src="style/js/neturl.js" type="text/javascript"></script>
		<script src="style/js/info.js" type="text/javascript"></script>
		<!--[if lte IE 8]>
    <script type="text/javascript" src="style/js/excanvas.js"></script>
<![endif]-->
		<script src="style/js/ajaxCross.json" charset="UTF-8"></script>
		<style type="text/css">
			select {
				width: 100%;
				height: 100%;
				background-color: #f54545;
				color: white;
				/* 去掉三角 */
				appearance: none;
				-moz-appearance: none;
				/* Firefox */
				-webkit-appearance: none;
				/* Safari 和 Chrome */
			}
		</style>
	</head>
	<body>
		<div id="body">
			<div id="container">

				<div style="" id="stepTip">
					<a></a>
					<img width="803" height="59" src="style/images/tiponce.jpg">
				</div>
				<div class="content_mid">
					<dl class="c_section c_section_mid">
						<dt>
							<h2><em></em>填写公司信息</h2>
						</dt>
						<dd>
							<form id="stepForm">
								<div class="c_text_1">基本信息为必填项，是求职者加速了解公司的窗口，认真填写吧！</div>

								<h3>公司名称</h3>
								<input type="text" placeholder="请输入公司名称，如:腾讯" value="" name="name" id="name" class="valid">


								<h3>公司网址</h3>
								<input type="text" placeholder="请输入公司网址" value="" name="website" id="website">

								<h3>所在城市</h3>
								<td>
									<select name="provincem" id="provincem" class="selectr selectr_300" style="margin-top: 20px">
										<option value="">省份</option>
										<!-- 利用js把省份添加到下拉列表里-->
										<script type="text/javascript">
											for (var i = 0; i < provinceArr.length; i++) {
												document.write("<option value='" + i + "'>" + provinceArr[i] + "</option>");
								
											}
										</script>
									</select>
									<select name="address" id="address" class="selectr selectr_300" style="margin-left: 20px;">
										<option value="">城市</option>
									</select>
								</td>

								<h3>行业领域</h3>
								<div>
									<input type="hidden" value="" name="select_industry_hidden" id="select_industry_hidden">
									<input type="button" value="请选择行业领域" name="select_industry" id="select_industry" class="select">
									<div class="dn" id="box_industry" style="display: none;">
										<ul class="reset" id="Profession">
											<script type="profession_html/html" id="profession_tem">
												{{each profession_json.records}}
													<li value="{{$value.id}}">{{$value.name}}</li>
												{{/each}}
											</script>
										</ul>
									</div>
								</div>

								<h3>公司规模</h3>
								<input type="number" placeholder="请输入人数规模" value="" name="scale" id="scale">

								<h3>公司创立时间</h3>
								<input type="date" value="2020-04-08" id="ctime" name="ctime" class="selectr_330">

								<h3>公司联系方式</h3>
								<input type="tel" id="phone" name="phone" class="selectr_330">

								<h3>公司邮箱地址</h3>
								<input type="text" id="email" name="email" class="selectr_330">

								<h3>公司介绍</h3>
								<textarea placeholder="请分段详细描述公司简介、企业文化等" name="companyProfile" id="companyProfile"></textarea>
								<div class="word_count">你可以输入 <span>200</span> 字</div>
								<div class="clear"></div>
								<input type="button" value="确认注册" id="register" class="btn_big fr">
							</form>
						</dd>
					</dl>
				</div>

				<script src="style/js/step1.min.js" type="text/javascript"></script>
				<script>
					var company_id = "";
					var username = "";
					var password = "";
					var profession_list = [];
					$(document).ready(function() {
						company_id = getCookie('company_id');
						username = UrlParm.parm("username");
						password = UrlParm.parm("password");
						getProfession();
					});
					function getCookie(name) {
						var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
						if (arr = document.cookie.match(reg))
							return unescape(arr[2]);
						else
							return null;
					}
					function getProfession() {
						$.ajax({ //传数据的方式
							url: ip_address + "/profession/list",
							type: "post",
							data: {
								pageSize: 500
							},
							success: function(result, textStatus, request) { //传数据成功之后的操作   result是servlet传过来的数据  这个函数对result进行处理，让它显示在 输入框中
								console.log('返回了' + JSON.stringify(result))
								var status = result.status;
								if (status == 0) {
									console.log('返回正确')
									var profession_data = result.data;
									profession_list = result.data.records;
									var profession_html = template('profession_tem', {
										profession_json: profession_data
									})
									var Profession = document.querySelector('#Profession');
									Profession.innerHTML = profession_html;
								} else {
									var msg = result.msg;
									alert(msg)
								}
							},
							error: function(Error) {
								console.log(Error);
							},
							complete: function(xhr, data) {
								console.log("complete");
							}
						});
					}
					$('#register').click(function(){
						var coptions=$("#address option:selected"); //获取选中的项
						var address = coptions.text(); //拿到选中项的文本
						var scale = $('#scale').val();
						var cname = $('#name').val();
						var email = $('#email').val();
						var phone = $('#phone').val();
						var ctime = $('#ctime').val();
						var introduce = $('#companyProfile').val();
						var chttp = $('#website').val();
						var professionIds = $('#select_industry').val();
						console.log(username+"用户名"+password);
						if(username==""||password==""||username==null||password==null){
							if (confirm("验证错误，请重新输入账号密码?")) {
								window.location.href = "register.html";
							}else{
								window.location.href = "register.html";
							}
							return;
						}
						if(cname == ""){
							alert("公司名称不能为空");
							return;
						}
						console.log("选择了"+address)
						if(address == "城市"){
							alert("公司地址不能为空");
							return;
						}
						if(phone == ""){
							alert("联系方式不能为空");
							return;
						}
						if(email == ""){
							alert("邮箱地址不能为空");
							return;
						}
						if(ctime == ""){
							alert("公司创立不能为空");
							return;
						}
						if(introduce == ""){
							alert("公司介绍不能为空");
							return;
						}
						if(professionIds == "请选择行业领域"){
							alert("请选择行业领域");
							return;
						}
						var isphone = checkPhone(phone);
						if(isphone == false){
							alert("联系方式格式不正确");
							return;
						}
						var isemail = checkEmail(email);
						// if(isemail == false){
						// 	alert("邮箱地址格式不正确");
						// 	return;
						// }
						var professionId_item = professionIds.split(',');
						var profession = []
						for(var i in professionId_item){
							for(var j in profession_list){
								if(professionId_item[i] == profession_list[j].name){
									profession.push(profession_list[j].id)
								}
							}
						}
						console.log("行业id是"+profession);
						var datas = {};
						datas['cname'] = cname;
						datas['ctime'] = ctime;
						datas['introduce'] = introduce;
						datas['address'] = address;
						datas['scale'] = scale;
						datas['chttp'] = chttp;
						datas['professionIds'] = profession;
						datas['phone'] = phone;
						datas['email'] = email;
						datas['userName'] = username;
						datas['password'] = password;
						$.ajax({ //传数据的方式
							url: ip_address+"/companys/add",
							type: "post",
							data: JSON.stringify(datas),
							contentType: "application/json;charset=utf-8", //必须要设置
							dataType: "json", //返回的数据格式为json
							success: function(result, request) { //传数据成功之后的操作   result是servlet传过来的数据  这个函数对result进行处理，让它显示在 输入框中
								console.log('返回了' + JSON.stringify(result))
								var status = result.status;
								if(status == 0){
									window.location.href = "success.html";
								}else{
									var msg = result.msg;
									alert(msg);
								}
							},
							error: function(Error) {
								console.log(Error);
							},
							complete: function(xhr, data) {
								console.log("complete");
							}
						});
					});
					
					/**
					 * 手机正则
					 */
					function checkPhone(phone){
						if(!(/^1(3|4|5|7|8)\d{9}$/.test(phone))){
							return false;
						}else{
							return true;
						}
					}
					/**
					 * 邮箱正则
					 */
					function checkEmail(email){
						var regEmail = /^([a-zA-Z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/;
						if(!regEmail.test(email)){
							return false;
						}else {
						    return true;
						}
					}
					
					//当省份的选择发生变化时调用 该方法   将市县加载到下拉选择框
					$("#provincem").change(function() {
						//1.获取省份选择框的对象
						var provincesobj = document.getElementById("provincem");
						//2.获取市县选择框的对象
						var cityobj = document.getElementById("address");
						//3.获取被选择的省份的索引
						var index = provincesobj.selectedIndex;
					
						//alert(provincesobj[index].value+","+provincesobj[index].text);
						////4.通过省份的索引获取它的value值，value值也是它在数组的索引值
						var value = provincesobj[index].value;
						//5.获取对应省份的市县数组
						var cityName = cityArr[value];
						//6.将下拉框清除索引为0之后的，只保留第一个
						cityobj.length = 1;
						//通过循环遍历市县元素给下拉框赋值
						for (var i = 1; i < cityArr[value].length; i++) {
							cityobj.options[cityobj.options.length] = new Option(cityName[i], i);
					
						}
					});
					var avatar = {};
					avatar.uploadComplate = function( data ){
						var result = eval('('+ data +')');
						if(result.success){
							jQuery('#logoShow img').attr("src",ctx+ '/'+result.content);
							jQuery.colorbox.close();
							jQuery('#logoNo').hide();
							jQuery('#logoShow').show();
						}
					};
				</script>
				<div class="clear"></div>
				<input type="hidden" value="13ae35fedd9e45cdb66fb712318d7369" id="resubmitToken">
				<a rel="nofollow" title="回到顶部" id="backtop" style="display: none;"></a>
			</div><!-- end #container -->
		</div><!-- end #body -->
		<div id="footer">
			<div class="wrapper">
				<a rel="nofollow" target="_blank" href="about.html">联系我们</a>
				<a target="_blank" href="http://www.lagou.com/af/zhaopin.html">互联网公司导航</a>
				<a rel="nofollow" target="_blank" href="http://e.weibo.com/lagou720">我们的微博</a>
				<a rel="nofollow" href="javascript:void(0)" class="footer_qr">我们的微信<i></i></a>
				<div class="copyright">&copy;2019-2020 qiuxinxin <a href="http://www.baidu.com"
					 target="_blank">东莞理工学院城市学院备14023790号-2</a></div>
		</div>

		<script src="style/js/core.min.js" type="text/javascript"></script>
		<script src="style/js/popup.min.js" type="text/javascript"></script>

		<!--  -->


		<div id="cboxOverlay" style="display: none;"></div>
		<div id="colorbox" class="" role="dialog" tabindex="-1" style="display: none;">
			<div id="cboxWrapper">
				<div>
					<div id="cboxTopLeft" style="float: left;"></div>
					<div id="cboxTopCenter" style="float: left;"></div>
					<div id="cboxTopRight" style="float: left;"></div>
				</div>
				<div style="clear: left;">
					<div id="cboxMiddleLeft" style="float: left;"></div>
					<div id="cboxContent" style="float: left;">
						<div id="cboxTitle" style="float: left;"></div>
						<div id="cboxCurrent" style="float: left;"></div><button type="button" id="cboxPrevious"></button><button type="button"
						 id="cboxNext"></button><button id="cboxSlideshow"></button>
						<div id="cboxLoadingOverlay" style="float: left;"></div>
						<div id="cboxLoadingGraphic" style="float: left;"></div>
					</div>
					<div id="cboxMiddleRight" style="float: left;"></div>
				</div>
				<div style="clear: left;">
					<div id="cboxBottomLeft" style="float: left;"></div>
					<div id="cboxBottomCenter" style="float: left;"></div>
					<div id="cboxBottomRight" style="float: left;"></div>
				</div>
			</div>
			<div style="position: absolute; width: 9999px; visibility: hidden; display: none;"></div>
		</div>
	</body>
</html>
